﻿/// <reference path="class/stage.ts" />
/// <reference path="class/player.ts" />
/// <reference path="class/lunar_monster.ts" />
/// <reference path="class/keyboard.ts" />
/// <reference path="class/menu/main_menu.ts" />
/// <reference path="Scripts/typings/jquery/jquery.d.ts" />

//declare var createjs;

var stage_manager;
var player;
var lunar_monster;

function init() {
    //var menu = new MainMenu();
    stage_manager = new StageManager();
    player = new Player(stage_manager,100,215);
    stage_manager.addEntityToStage(player.getPlayerEntity());
    Keyboard.init();

    lunar_monster = new LunarMonster(stage_manager,450,200);
    stage_manager.addEntityToStage(lunar_monster.getEntity());

    //gestion des event des touches
    document.onkeydown = Keyboard.keydown;
    document.onkeyup = Keyboard.keyup;

    document.getElementById("label").innerHTML = "Script charg&eacute;";
}


// boucle principal
function tick(event) {
    player.tick();
    lunar_monster.tick();

    //si collision avec monstre
    if (lunar_monster.hitTest(player)) {
        player.deathAnimation();
    }

    stage_manager.update();
}

function run() {   
    player.runAnimation();
}

